﻿using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity;
using Volo.Abp.Threading;
using Xms.Abp.Application;
using Xms.Abp.Authorization;

namespace MemberManagement;

[DependsOn(
    typeof(XmsAbpDddApplicationContractsModule),
    typeof(MemberManagementDomainSharedModule),
    typeof(XmsAbpAuthorizationAbstractionsModule)
    )]
public class MemberManagementApplicationContractsModule : XmsAbpDddApplicationContractsBaseModule
{
    private static readonly OneTimeRunner OneTimeRunner = new();

    public override void PostConfigureServices(ServiceConfigurationContext context)
    {
        OneTimeRunner.Run(() =>
        {
            ModuleExtensionConfigurationHelper
                .ApplyEntityConfigurationToApi(
                    MemberManagementModuleExtensionConsts.ModuleName,
                    MemberManagementModuleExtensionConsts.EntityNames.Member,
                    getApiTypes: new[] { typeof(MemberResult) },
                    createApiTypes: new[] { typeof(MemberCreateParameter) },
                    updateApiTypes: new[] { typeof(MemberUpdateParameter) }
                );
        });
    }
}
